/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.openjawtech.xscraper.web.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.ArrayList;
import com.openjawtech.xscraper.web.service.AirportsService;
import com.openjawtech.xscraper.web.service.FlightsService;
import static com.openjawtech.xscraper.web.util.FormatUtil.firstToUpper;
/**
 *
 * @author Wenbo.Sun
 */
public class AirportsServiceImpl implements AirportsService {

    @Autowired
    private FlightsService flightsService;

    public List<String> getAllArrivals(String departure) {
        String[] airports = flightsService.getAllArrivals(departure);
        ArrayList<String> list = new ArrayList<String>();
        for(String airport:airports){
            list.add(firstToUpper(airport));
        }
        return list;
    }

    public List<String> getAllDepartures() {
        String[] airports = flightsService.getAllAirports();
        ArrayList<String> list = new ArrayList<String>();
        for(String airport: airports){
            list.add(firstToUpper(airport));
        }
        return list;
    }
}
